package worker

import (
	"NovelBook/dao"
	"NovelBook/models/db_models"
)

// 离职

func SetWorkersOff(WorkerIDs []uint) error {

	err := dao.GetDb().Model(db_models.Worker{}).Where("id IN (?)", WorkerIDs).Update("state", 0).Error
	if err != nil {
		return err
	}
	return nil
}

// 复职

func SetWorkersOn(WorkerIDs []uint) error {

	err := dao.GetDb().Model(db_models.Worker{}).Where("id IN (?)", WorkerIDs).Update("state", 1).Error
	if err != nil {
		return err
	}
	return nil
}
